package io.renren.modules.avanotes.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

/**
 * 基于 SuperMemo 的专题复习计算
 *
 * @author zzr
 * @email 529742454@qq.com
 * @date 2022-05-11 15:52:38
 */
@NoArgsConstructor
@Data
@TableName("supermemo2_special_review")
public class Supermemo2SpecialReviewEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    public static String CN_ID = "id";
    public static String CN_SCHEDULE_ID = "schedule_id";
    public static String CN_SPECIAL_ID = "special_id";
    public static String CN_CURRENT_EF = "current_ef";
    public static String CN_CURRENT_QUANTITY = "current_quantity";
    public static String CN_ISLATEST = "isLatest";
    public static String CN_NVALUE = "nValue";
    public static String CN_INTERVAL_DAYS = "interval_days";
    public static String CN_CREATE_USER_ID = "create_user_id";
    public static String CN_CREATE_TIME = "create_time";

    /**
     * 主键id
     */
    @TableId
    private Long id;
    /**
     * 计划id（需要结合计划ID）
     */
    private Long scheduleId;
    /**
     * 专题id（实际还是以专题为单位）
     */
    private Long specialId;
    /**
     * 当前电子因子值
     */
    private Double currentEf;
    /**
     * 当前相应质量（5-完美响应/完全掌握；4-犹豫后正确的响应/基本掌握；3-严重困难时召回的正确响应/不太掌握；2-错误的响应；正确的人似乎容易被回忆的地方/完全不会！1-错误的回答；正确的记忆/完全不会！0-完全停电/完全不会！）
     */
    private Integer currentQuantity;
    /**
     * 是否为最近的
     */
    private Integer islatest;
    /**
     * n的值
     */
    private Integer nvalue;
    /**
     * 间隔天数
     */
    private Integer intervalDays;
    /**
     * 评价用户id
     */
    private Long createUserId;
    /**
     * 创建时间
     */
    private Date createTime;


    public Supermemo2SpecialReviewEntity(Long scheduleId, Long specialId, Double currentEf, Integer currentQuantity, Integer islatest, Integer nvalue, Integer interval, Long createUserId) {
        this.scheduleId = scheduleId;
        this.specialId = specialId;
        this.currentEf = currentEf;
        this.currentQuantity = currentQuantity;
        this.islatest = islatest;
        this.nvalue = nvalue;
        this.intervalDays = interval;
        this.createUserId = createUserId;

        this.createTime = new Date();
    }

    public static Supermemo2SpecialReviewEntity createFirstSM2(Long scheduleId, Long specialId, Long createUserId) {
        return new Supermemo2SpecialReviewEntity(scheduleId, specialId, 2.5d, 0, 1, 1, 1, createUserId);
    }

    public static Supermemo2SpecialReviewEntity createSecondSM2(Long scheduleId, Long specialId, Long createUserId) {
        return new Supermemo2SpecialReviewEntity(scheduleId, specialId, 2.5d, 0, 1, 2, 6, createUserId);
    }
}